

define(function(require,exports,module){

	function Main(jqObj,loadParams){

		var columns = [[
			{field:'codeId',title:'id',hidden:true},
			{field:'codeTypeName',title:'字典类别',editor:{
				required:true,
				eName:'combobox',
				name:'codeType',
				editable:false,
				valueField: 'codeValue',
				textField: 'codeName',
				panelHeight:'auto',
				queryParams:{codeType:1},
				url:'sys/firecode/json.do'
			}},
			{field:'codeName',title:'字典名称',width:200,editor:{required:true}},
			{field:'codeValue',title:'字段值',editor:{required:true}},
			{field:'codeDesc1',title:'字典描述一',editor:{}},
			{field:'codeDesc2',title:'字典描述二',editor:{}},
			{field:'codeDesc3',title:'字典描述三',editor:{}},
			{field:'codeDesc4',title:'字典描述四',editor:{}},
			{field:'remark',title:'备注',editor:{}}
		]];
		
		var formDialog = {
			title:'字典',
			//height:300,
			formEx:{
				url:'sys/firecode/save.do'
			}
		}
	
		var MainUI = {
			eName:'datagrid',
			idField:'codeId',
			url:'sys/firecode/json.do',
			delUrl:'sys/firecode/del.do',
			columns:columns,
			formDialog:formDialog,
			queryParams:{codeType:1},
			onBeforeAdd:function(row){
				row.codeType = self.mybox.combobox('getValue');
			},
			toolbarEx:[{
				eName:'combobox',
				editable:false,
				valueField: 'codeValue',
				textField: 'codeName',
				value:'1',//默认值
				width:100,
				queryParams:{codeType:1},
				url:'sys/firecode/json.do',
				onChange:function(newValue, oldValue){//combobox事件
					self.mygrid.datagrid('load',{'codeType':newValue});
				}
			}]
		}
		jqObj.createUI(MainUI);
		self.mygrid = jqObj.findJq('datagrid');
		self.mybox = jqObj.findJq('combobox');
	
	}
	module.exports = Main;

});
